package com.spring.soundsystem.aop;

import com.spring.soundsystem.SpringAOP.UserServiceImpl;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogAdvice {
    @Before("execution(* com.spring.soundsystem.SpringAOP.*.*(..))")
    public void doSomething(){
        System.out.println("doSomething......");
    }
    @Pointcut("execution(* com.spring.soundsystem.SpringAOP.*.*(..))")
    public void pointcut(){

    }
    @Around("pointcut()")
    public Object doWork(ProceedingJoinPoint pjp) throws Throwable{
        System.out.println("before dowork....");
        Object ret = pjp.proceed();
        System.out.println("retVal=" + ret);
        System.out.println("after dowork......");
        return ret;
    }
}
